<html>
	<head>
		<script>

			function testSubmission() {

				var element = document.getElementById("layerElement");
				var layer = element.value;
				
				var url = "featurelist/" + layer;

				
				submit("GET",url,null,downloadComplete);
			}
			
			
			function downloadComplete(result) {
				var element = document.getElementById("featuresElement");
				element.value = result;
			}

			function submit(method,url,body,onDownload) {

				var xmlhttp = new XMLHttpRequest();

				xmlhttp.onreadystatechange=function() {
					if (xmlhttp.readyState==4 && xmlhttp.status==200) {
						onDownload(xmlhttp.responseText);

					}
					else if(xmlhttp.readyState==4) {
						alert("Error in request, Status: " + xmlhttp.status);
					}
				}

				xmlhttp.open(method,url,true);
				xmlhttp.send(body);
			}

		</script>
	</head>
	<body>
		<h1>Feature List Test</h1>
		layer: <textarea id="layerElement" cols="31"></textarea><br>
		<input type="button" value="Download Test" onclick="testSubmission()"/><br>
		out: <textarea id="featuresElement" cols="70" rows="30"></textarea><br>
		
	</body>
</html>
